﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using ArcEngine.Resources;



namespace ArcEngine.Editor.Wizards
{
	public partial class NewGuiButtonWizard : Form
	{
		public NewGuiButtonWizard(Layout layout)
		{
			InitializeComponent();

			this.layout = layout;
		}


		/// <summary>
		/// 
		/// </summary>
		/// <param name="sender"></param>
		/// <param name="e"></param>
		private void NewModelWizard_FormClosing(object sender, FormClosingEventArgs e)
		{
			if (DialogResult != DialogResult.OK)
				return;

			// Script already exists ?
			if (string.IsNullOrEmpty(NameBox.Text) || layout.GetElement(NameBox.Text) != null)
			{
				MessageBox.Show("Name already in use or invalid. Use another name !");
				e.Cancel = true;
				return;
			}


			layout.CreateButton(NameBox.Text);

		}


		/// <summary>
		/// 
		/// </summary>
		Layout layout;

	}
}
